<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport"
        content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0,viewport-fit=cover" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>Hello APP</title>
    <link rel="stylesheet" type="text/css" href="../css/vant.css">
    <link rel="stylesheet" type="text/css" href="../css/base.css" />
    <link rel="stylesheet" type="text/css" href="../css/local.css" />
    <script type="text/javascript" src="../script/jquery.js"></script>
    <script type="text/javascript" src="../script/layer/mobile/layer.js"></script>
    <script type="text/javascript" src="../script/vue.min.js"></script>
    <script type="text/javascript" src="../script/vant.min.js"></script>
    <script type="text/javascript" src="../script/fastclick.js"></script>
    <script type="text/javascript" src="../script/base.js"></script>
    <style type="text/css">
        .title {
            font-size: 17px;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            word-break: break-all;
            padding-right: 10px;
        }

        .date {
            float: right;
            font-size: 12px;
            color: #cbcbcb;
        }

        .sub {
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            word-break: break-all;
            font-size: 14px;
            color: #a3a3a3;
        }

        .creater {
            font-size: 14px;
        }

        .creater2 {
            font-size: 12px;
        }

        .result span {
            background: #fdf9f8;
            border: 1px solid #eeebec;
            border-radius: 10px;
            font-size: 12px;
            transform: scale(0.9);
            display: inline-block;
            height: 16px;
            line-height: 14px;
            padding: 0 2px;
        }

        .status-0 span {
            transform: scale(1);
            border: 0;
            background: #ffffff;
            color: #e3b474;
        }

        .status-1 span {
            color: #47ba9c;
        }

        .status-2 span {
            color: #dd7e70;
        }

        .bo {
            padding-top: 10px;
        }

        .sq {
            display: inline-block;
            font-size: 13px;
            padding: 0 2px;
            margin-right: 5px;
            min-width: 16px;
            height: 18px;
            line-height: 18px;
            border-radius: 4px;
            text-align: center;
            background-color: #3396fb;
            color: #ffffff;

        }

        .title span {
            vertical-align: middle;
        }
    </style>
</head>

<body>
    <div id="app" v-cloak>
        <div class="box" style="user-select:none;">
            <van-nav-bar-main :title="titleName" left-arrow @click-left="onClickLeft">
                <!-- <div slot="right">
                     <span @click="showSearch = true;">
                         <van-icon name="search" size="18px"></van-icon>
                     </span>
                 </div> -->
            </van-nav-bar-main>

            <div class="content">
                <!-- <van-list v-model="listLoading" :finished="listFinished" finished-text="没有更多了" @load="listOnLoad"> -->
                <van-cell-group>
                    <van-cell @click="intoRow(row)" v-for="(row,index) in dataList">
                        <div>
                            <van-row>
                                <van-col span="24">
                                    <div class="flex-box">
                                        <div class="flex-main title"><span
                                                class="sq">{{index+1}}</span><span>{{row.ProductName}}</span></div>
                                    </div>
                                </van-col>

                                <van-col span="12">
                                    <div class="flex-box bo">
                                        发送日期：{{row.BDate}}
                                    </div>
                                </van-col>

                                <van-col span="12">
                                    <div class="flex-box bo">
                                        批次：{{row.Batch}}
                                    </div>
                                </van-col>

                                <!-- <van-col span="12">
                                    <div class="flex-box bo">
                                        产品名称：{{row.ProductName}}
                                    </div>
                                </van-col> -->

                                <van-col span="12">
                                    <div class="flex-box bo">
                                        不良原因：{{row.BadReasonName}}
                                    </div>
                                </van-col>

                                <van-col span="12">
                                    <div class="flex-box bo">
                                        不良数量：{{row.Amount}}
                                    </div>
                                </van-col>

                                <van-col span="12">
                                    <div class="flex-box bo">
                                        不良率：{{row.Rate}}
                                    </div>
                                </van-col>

                            </van-row>
                        </div>
                    </van-cell>
                </van-cell-group>


                <!-- </van-list> -->

            </div>
        </div>
    </div>
</body>
<script type="text/javascript">
    var vm;
    apiready = function () {

        api.addEventListener({
            name: 'refreshList'
        }, function (ret, err) {
            vm.pageIndex = 1;
            vm.getDataList();
        })

        var dateIndex = 0;

        vm = new Vue({
            el: '#app',
            data: {
                showLoading: false,
                showSearch: false,
                titleName: api.pageParam.titleName,
                // id: api.pageParam.id,
                MSGContent: api.pageParam.MSGContent,
                BDate: api.pageParam.BDate,
                // listLoading: false,
                // listFinished: true,
                // // pageSize: 30,
                // pageIndex: 1,
                dataList: [],
                // currentDate: new Date(),
                // showDate: false,
                searchData: {}
            },
            created: function () {
                var that = this;
                that.getDataList();
            },
            methods: {
                getDataList: function () {
                    var that = this;
                    that.showLoading = true;
                    var obj = {
                        MSGContent: that.MSGContent,
                        BDate: that.BDate
                    }
                    console.log(JSON.stringify(obj))
                    APP.ajax('getPzMsgDetail', obj, function (res) {
                        console.log(JSON.stringify(res))
                        that.showLoading = false;
                        // that.listFinished = false;
                        that.dataList = res.ds;
                        // console.log(JSON.stringify(that.dataList))
                    })

                },
                // listOnLoad: function () {
                //     var that = this;
                //     that.pageIndex++;
                //     var obj = {
                //         MSGContent:'',   
                //         BDate:''
                //     }
                //     APP.ajax('getPzMsgDetail', obj, function (res) {
                //         that.listLoading = false;
                //         if (res.ds.length == 0) {
                //             that.listFinished = true;
                //         }
                //         that.dataList = that.dataList.concat(res.ds);
                //     })
                // },
                onClickLeft: function () {
                    api.closeWin();
                }
            }
        })

    };
</script>

</html>